﻿// *****************************************************************
//    Copyright (c) Microsoft. All rights reserved.
//    This code is licensed under the Apache License, Version 2.0.
//    THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
//    ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
//    IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
//    PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
// *****************************************************************

using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Bio.TestAutomation.Util;
using Bio.Util.Logging;
using Bio.Distributions;

namespace Bio.TestAutomation.Distributions
{
    /// <summary>
    /// Bvt Test Cases Fir MissingStatistics Class
    /// </summary>
    [TestClass]
    public class MissingStatisticsBvtTestCases
    {
        #region Constructor

        /// <summary>
        /// Static constructor to open log and make other settings needed for test
        /// </summary>
        static MissingStatisticsBvtTestCases()
        {
            Trace.Set(Trace.SeqWarnings);
            if (!ApplicationLog.Ready)
            {
                ApplicationLog.Open("bio.automation.log");
            }
        }

        #endregion Constructor

        #region MissingStatistics Bvt Test Cases

        /// <summary>
        /// validates the GetInstance property
        /// </summary>
        [TestMethod]
        [Priority(0)]
        [TestCategory("Priority0")]
        public void ValidateMissingStatisticsGetInstance()
        {
            MissingStatistics missingStat = MissingStatistics.GetInstance;
            Assert.IsTrue(missingStat.IsMissing());
        }

        /// <summary>
        /// validates the GetHashCode method
        /// </summary>
        [TestMethod]
        [Priority(0)]
        [TestCategory("Priority0")]
        public void ValidateMissingStatisticsGetHashCode()
        {
            MissingStatistics missingStat = MissingStatistics.GetInstance;
            Assert.AreEqual(missingStat.GetHashCode(), MissingStatistics.GetInstance.GetHashCode());
        }

        /// <summary>
        /// validates the Equals method
        /// </summary>
        [TestMethod]
        [Priority(0)]
        [TestCategory("Priority0")]
        public void ValidateMissingStatisticsEquals()
        {
            SufficientStatistics suffStat = null;
            MissingStatistics missingStat = MissingStatistics.GetInstance;
            Assert.IsFalse(missingStat.Equals(suffStat));

            suffStat = (SufficientStatistics)missingStat;
            Assert.IsTrue(missingStat.Equals(suffStat));

            missingStat = MissingStatistics.GetInstance;
            suffStat = (SufficientStatistics)missingStat;
            Assert.IsTrue(missingStat.Equals(suffStat));

            object suffStatObj = (object)missingStat;
            Assert.IsTrue(missingStat.Equals(suffStat));
        }

        /// <summary>
        /// validates the TryParse method
        /// </summary>
        [TestMethod]
        [Priority(0)]
        [TestCategory("Priority0")]
        public void ValidateMissingStatisticsTryParse()
        {
            SufficientStatistics result = null;
            MissingStatistics missingStat = MissingStatistics.GetInstance;
            Assert.IsTrue(MissingStatistics.TryParse("?", out result));
            Assert.IsTrue(missingStat.Equals(result));
            Assert.IsTrue(MissingStatistics.TryParse("missing", out result));
            Assert.IsTrue(missingStat.Equals(result));
        }

        /// <summary>
        /// validates properties of the MissingStatistics class
        /// </summary>
        [TestMethod]
        [Priority(0)]
        [TestCategory("Priority0")]
        public void ValidateMissingStatisticsConstants()
        {
            char missingChar = MissingStatistics.MissingChar;
            Assert.AreEqual('?', missingChar);
        }

        /// <summary>
        /// validates the ToString method
        /// </summary>
        [TestMethod]
        [Priority(0)]
        [TestCategory("Priority0")]
        public void ValidateMissingStatisticsToString()
        {
            MissingStatistics missingStat1 = MissingStatistics.GetInstance;
            Assert.AreEqual("?", missingStat1.ToString());
        }

        #endregion MissingStatistics Bvt Test Cases
    }
}
